import 'package:number_spark_flutter/pages/ns_record/ns_record_logic.dart';
import 'package:number_spark_flutter/utils/ns_log_report_utils.dart';
import 'package:get/get.dart';

class NSBottomBarModel {
  String icon;
  String activeIcon;

  NSBottomBarModel(this.icon, this.activeIcon);
}

class NSMainLogic extends GetxController {
  List<NSBottomBarModel> bottomList = [
    NSBottomBarModel('icon_tab_0_nor.png', 'icon_tab_0_select.png'),
    NSBottomBarModel('icon_tab_1_nor.png', 'icon_tab_1_select.png'),
    NSBottomBarModel('icon_tab_2_nor.png', 'icon_tab_2_select.png'),
  ];
  int selectedIndex = 0;

  onSwitchBottomBar(i) {
    selectedIndex = i;
    update();
    if (selectedIndex == 0) {
      NSLogReportUtils.stat(page: NSLogPages.nsHome);
    } else if (selectedIndex == 1) {
      NSLogReportUtils.stat(page: NSLogPages.nsRecord);
      if (Get.isRegistered<NSRecordLogic>()) {
        Get.find<NSRecordLogic>().onGetRecordList();
      }
    } else if (selectedIndex == 2) {
      NSLogReportUtils.stat(page: NSLogPages.nsMine);
    }
  }
}
